package com.imooc.netty;

import java.util.HashMap;

import io.netty.channel.Channel;

/***
 *                    _ooOoo_
 *                   o8888888o
 *                   88" . "88
 *                   (| -_- |)
 *                    O\ = /O
 *                ____/`---'\____
 *              .   ' \\| |// `.
 *               / \\||| : |||// \
 *             / _||||| -:- |||||- \
 *               | | \\\ - /// | |
 *             | \_| ''\---/'' | |
 *              \ .-\__ `-` ___/-. /
 *           ___`. .' /--.--\ `. . __
 *        ."" '< `.___\_<|>_/___.' >'"".
 *       | | : `- \`.;`\ _ /`;.`/ - ` : | |
 *         \ \ `-. \_ __\ /__ _/ .-` / /
 * ======`-.____`-.___\_____/___.-`____.-'======
 *                    `=---='
 *
 * .............................................
 *          佛祖保佑             永无BUG
 */
/***
 * @ClassName: UserChannelRel
 * @Description: 用户id和channel的关联关系处理
 * @author: wupeng
 * @date: 2018年12月24日 下午5:11:53
 */
public class UserChannelRel
{
	private static HashMap<String, Channel> manager = new HashMap<>();

	public static void put(String senderId, Channel channel)
	{
		manager.put(senderId, channel);
	}

	public static Channel get(String senderId)
	{
		return manager.get(senderId);
	}

	public static void output()
	{
		for (HashMap.Entry<String, Channel> entry : manager.entrySet())
		{
			System.out.println("userId:" + entry.getKey() + ", channelId:" + entry.getValue().id().asLongText());
		}
	}
}
